home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000320_sjt@enlil.museum.upenn.edu_Wed, 16 Feb 94 09:35:41 GMT.msg < prev    next >
Internet Message Format  |  1994-10-11  |  10KB

  1. Received: from ENLIL.MUSEUM.UPENN.EDU by cs.umb.edu with SMTP id AA00553
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Thu, 17 Feb 1994 01:35:42 -0500
  3. Return-Path: <sjt@enlil>
  4. Received: by enlil.museum.upenn.edu (IBM OS/2 SENDMAIL VERSION 1.2.12/1.2)
  5.       id AA1519; Wed, 16 Feb 94 09:35:41 GMT
  6. Date: Wed, 16 Feb 94 09:35:41 GMT
  7. From: sjt@enlil.museum.upenn.edu
  8. Message-Id: <9402160935.AA1519@enlil.museum.upenn.edu>
  9. To: tex-k@cs.umb.edu
  10.  
  11.  
  12. First of all, many thanks to Karl and all the others for the wonderful
  13. work on the Web2C distribution. Now down to business. I believe the
  14. Virtual font handling in xdvi 1.6 is somewhat broken. Specifically, I
  15. use VF's in an encoding wherein the top-level VF only includes a
  16. variety of other VF's, and does not exist as a pixel file. Xdvi's
  17. behaviour with this is to complain about not finding a pixel file for
  18. the top-level VF. I have modified xdvi to use the following logic when
  19. seeking fonts, and append a context diff to that effect. Note that, as
  20. I expound below, this is not a complete solution. It works for me,
  21. though, and I hope it doesn't break existing VF's---shouldn't, as far
  22. as I can tell. Because I'm not an expert on xdvi or VF's, and don't
  23. have the time to become one, I am giving a fairly long and boring
  24. explanation of what I did so that someone who knows better can catch
  25. any major blunders.
  26.  
  27. The basic point is that a VF file per se should never be sought as a
  28. pixel file. Rather, each font in the VF font-map should be checked for
  29. virtualness, and only non-virtual font-map entries should be looked
  30. for as pixel files. This gives us, basically:
  31.  
  32.     0) To find a given font:
  33.          is font at top-level?
  34.        yes->allow any font, including virtual
  35.        no->is font and scaling same as VF parent?
  36.            yes->require pixel font [avoids looping on VF, but see below]
  37.              no->allow any font, including virtual
  38.     1) Find a VF? 
  39.     yes-> for each font in VF font map go to 0.
  40.     no-> read pixel file or complain as usual
  41.  
  42. We see from this that the presence of a virtual parent is not enough
  43. to suppress font loading (this is the current state of the VF
  44. code). Rather, we must use the virtual parent-child relationship to
  45. impose constraints.
  46.  
  47. Unfortunately, the above is still not a complete solution, because we
  48. should really only load fonts if the page contains a character in that
  49. font, a la dvips. Given a virtual font ptmr:
  50.  
  51.       ptmr -> mapfont 0 ptmr scaled 800 [I forget the VPL syntax]
  52.  
  53. the present xdvi algorithm should loop infinitely as it attempts to
  54. load a new font scaled against the parent for each child loaded (not
  55. tested!).  Dvips handles this correctly because any given character
  56. occurs in a terminal size. Note that such a VF is legal as far as I
  57. can tell. [EmTeX's OS/2 dvipm program (probably amongst others) bombs
  58. on this.]
  59.  
  60.  Steve
  61.  
  62. ----------------------------------------------------------------------
  63. Steve Tinney                                        Babylonian Section
  64.                    University Museum of the University of Pennsylvania
  65. sjt@enlil.museum.upenn.edu                     Phila, PA. 215-898-4047
  66.  
  67.  
  68. ==begin===============================================================
  69.  
  70. diff -c /usr/local/src/xdvik-1.6/xdvik/dvi_draw.c ./dvi_draw.c
  71. *** /usr/local/src/xdvik-1.6/xdvik/dvi_draw.c    Fri Jul 23 21:47:49 1993
  72. --- ./dvi_draw.c    Sun Feb 13 19:18:46 1994
  73. ***************
  74. *** 630,636 ****
  75.   #endif
  76.       WIDEARG(ubyte, int)    ch;
  77.   {
  78. !     if (load_font(currinf.fontp)) {    /* if not found */
  79.           Fputs("Character(s) will be left blank.\n", stderr);
  80.           currinf.set_char_p = currinf.fontp->set_char_p = set_empty_char;
  81.   #ifndef    TEXXET
  82. --- 630,637 ----
  83.   #endif
  84.       WIDEARG(ubyte, int)    ch;
  85.   {
  86. !     if (load_font(currinf.fontp, 1)) {    /* if not found */ /* sjt: not sure if vf_ok
  87. !                                               arg is relevant here */
  88.           Fputs("Character(s) will be left blank.\n", stderr);
  89.           currinf.set_char_p = currinf.fontp->set_char_p = set_empty_char;
  90.   #ifndef    TEXXET
  91. diff -c /usr/local/src/xdvik-1.6/xdvik/dvi_init.c ./dvi_init.c
  92. *** /usr/local/src/xdvik-1.6/xdvik/dvi_init.c    Wed Feb  2 15:07:52 1994
  93. --- ./dvi_init.c    Sun Feb 13 19:13:55 1994
  94. ***************
  95. *** 161,168 ****
  96.    */
  97.   
  98.   Boolean
  99. ! load_font(fontp)
  100.       struct font *fontp;
  101.   {
  102.       float    fsize    = fontp->fsize;
  103.       int    dpi    = fsize + 0.5;
  104. --- 161,169 ----
  105.    */
  106.   
  107.   Boolean
  108. ! load_font(fontp, vf_ok)
  109.       struct font *fontp;
  110. +         char vf_ok;
  111.   {
  112.       float    fsize    = fontp->fsize;
  113.       int    dpi    = fsize + 0.5;
  114. ***************
  115. *** 178,184 ****
  116.       fontp->flags |= FONT_LOADED;
  117.       fontp->file = font_open(fontp->fontname, &font_found,
  118.           (WIDEARG(float, double)) fsize, &size_found, 
  119. !         &fontp->filename);
  120.       if (fontp->file == NULL) {
  121.           Fprintf(stderr, "xdvi: Font %s not found.\n", fontp->fontname);
  122.           return True;
  123. --- 179,185 ----
  124.       fontp->flags |= FONT_LOADED;
  125.       fontp->file = font_open(fontp->fontname, &font_found,
  126.           (WIDEARG(float, double)) fsize, &size_found, 
  127. !         &fontp->filename, vf_ok);
  128.       if (fontp->file == NULL) {
  129.           Fprintf(stderr, "xdvi: Font %s not found.\n", fontp->fontname);
  130.           return True;
  131. ***************
  132. *** 194,199 ****
  133. --- 195,201 ----
  134.       else if (!kpse_check_bitmap_tolerance (size_found / 5.0, dpi))
  135.             Fprintf(stderr, "xdvi: Font %s at %d not found; using %d instead.\n",
  136.             fontp->fontname, dpi, (size_found + 2) / 5);
  137. +     
  138.       fontp->fsize = (float) size_found / 5;
  139.       fontp->timestamp = ++current_timestamp;
  140.       fontp->maxchar = maxchar = 255;
  141. ***************
  142. *** 322,327 ****
  143. --- 324,330 ----
  144.       int len;
  145.       char *fontname;
  146.       int size;
  147. +     char vf_ok;
  148.   
  149.       tnp = (struct tn *) xmalloc((unsigned) sizeof(struct tn),
  150.           "TeXnumber structure");
  151. ***************
  152. *** 377,383 ****
  153. --- 380,399 ----
  154.           fontp->flags = FONT_IN_USE;
  155.           fontp->dimconv = scale * scale_dimconv / (1<<20);
  156.           fontp->set_char_p = load_n_set_char;
  157. + #if 0
  158.           if (vfparent == NULL) font_not_found |= load_font(fontp);
  159. + #else
  160. +         if (vfparent == NULL 
  161. +             || strcmp(vfparent->fontname, fontp->fontname) 
  162. +             || vfparent->fsize != fontp->fsize) /* sjt: not sure if this last
  163. +                                is exactly right; should
  164. +                                dimconv be factored in 
  165. +                                here, too? */
  166. +           vf_ok = 1;
  167. +         else
  168. +           vf_ok = 0;
  169. +         font_not_found |= load_font(fontp, vf_ok);
  170. + #endif
  171.           fontp->next = font_head;
  172.           font_head = fontp;
  173.           break;
  174. diff -c /usr/local/src/xdvik-1.6/xdvik/font-open.c ./font-open.c
  175. *** /usr/local/src/xdvik-1.6/xdvik/font-open.c    Tue Dec  7 19:14:27 1993
  176. --- ./font-open.c    Sun Feb 13 19:13:56 1994
  177. ***************
  178. *** 58,75 ****
  179.   
  180.   /* We try for a VF first because that's what dvips does.  Also, it's
  181.      easier to avoid running MakeTeXPK if we have a VF this way.  I doubt it
  182. !    makes any practical difference.  */
  183.   
  184.   FILE *
  185. ! font_open (font, font_ret, dpi, mag_ret, filename_ret)
  186.       _Xconst char *font;
  187.       char **font_ret;
  188.       float dpi;
  189.       int *mag_ret;
  190.       char **filename_ret;
  191.   {
  192.     FILE *ret;
  193. !   char *name = try_vf (font, font_ret);
  194.     
  195.     if (name)
  196.       /* VF fonts don't have a resolution, but loadfont will complain if
  197. --- 58,76 ----
  198.   
  199.   /* We try for a VF first because that's what dvips does.  Also, it's
  200.      easier to avoid running MakeTeXPK if we have a VF this way.  I doubt it
  201. !    makes any practical difference. (Yes, it does--sjt) */
  202.   
  203.   FILE *
  204. ! font_open (font, font_ret, dpi, mag_ret, filename_ret, vf_ok)
  205.       _Xconst char *font;
  206.       char **font_ret;
  207.       float dpi;
  208.       int *mag_ret;
  209.       char **filename_ret;
  210. +     char vf_ok;
  211.   {
  212.     FILE *ret;
  213. !   char *name = vf_ok ? try_vf (font, font_ret) : NULL;
  214.     
  215.     if (name)
  216.       /* VF fonts don't have a resolution, but loadfont will complain if
  217. diff -c /usr/local/src/xdvik-1.6/xdvik/xdvi.h ./xdvi.h
  218. *** /usr/local/src/xdvik-1.6/xdvik/xdvi.h    Wed Feb  2 15:23:39 1994
  219. --- ./xdvi.h    Sun Feb 13 19:16:05 1994
  220. ***************
  221. *** 429,435 ****
  222.   extern    void    reset_fonts(void);
  223.   extern    void    realloc_font(struct font *, WIDEARG(ubyte, int));
  224.   extern    void    realloc_virtual_font(struct font *, WIDEARG(ubyte, int));
  225. ! extern    Boolean    load_font(struct font *);
  226.   extern    void    define_font(FILE *, WIDEARG(ubyte, unsigned int), struct font *,
  227.               struct tn **);
  228.   extern    void    init_page(void);
  229. --- 429,435 ----
  230.   extern    void    reset_fonts(void);
  231.   extern    void    realloc_font(struct font *, WIDEARG(ubyte, int));
  232.   extern    void    realloc_virtual_font(struct font *, WIDEARG(ubyte, int));
  233. ! extern    Boolean    load_font(struct font *, char);
  234.   extern    void    define_font(FILE *, WIDEARG(ubyte, unsigned int), struct font *,
  235.               struct tn **);
  236.   extern    void    init_page(void);
  237. ***************
  238. *** 447,453 ****
  239.   extern    void    draw_page(void);
  240.   extern    void    init_font_open(void);
  241.   extern    FILE    *font_open(_Xconst char *, char **,
  242. !             WIDEARG(float, double), int *, char **);
  243.   extern    void    applicationDoSpecial(char *);
  244.   extern    void    read_PK_index(struct font *);
  245.   extern    void    read_GF_index(struct font *);
  246. --- 447,453 ----
  247.   extern    void    draw_page(void);
  248.   extern    void    init_font_open(void);
  249.   extern    FILE    *font_open(_Xconst char *, char **,
  250. !             WIDEARG(float, double), int *, char **, char);
  251.   extern    void    applicationDoSpecial(char *);
  252.   extern    void    read_PK_index(struct font *);
  253.   extern    void    read_GF_index(struct font *);
  254.  
  255. ==end================================================================
  256.  
  257.  
  258.